package com.sali.model;


import com.sali.custom_validator.int_check.IntValueLimit;
import com.sali.custom_validator.mobile_check.IsMobile;
import com.sali.custom_validator.sex_check.IsSex;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class UserRegRequest implements java.io.Serializable{

    @NotBlank(message = "请输入账号")
    private String account;

    @NotBlank(message = "请输入密码")
    @Length(min = 3,max = 16,message = "输入的密码必须是3~16位")
    private String password;

    @NotBlank(message = "请输入手机")
    @IsMobile(message="请输入合法的手机号码")
    private String phone;

    @NotBlank(message = "请输入邮箱")
    @Email(message = "请填写正确的邮箱地址")
    private String email;

    @NotBlank(message = "请输入性别，必须是：(F,M)")
    @IsSex(value={"F","M"},message="请填写正确的性别")
    private String sex;

    @NotEmpty(message = "级别不能为空")
    private String level;

    @NotNull(message = "登录类型不能为空")
    @IntValueLimit(intValues = {1,5}, message = "登录类型值不符合.比如是:{1,5}")
    private Integer loginType;

}
